//
//  NSAttributedString+Extension.swift
//  weiBo项目准备
//
//  Created by 鲜世杰 on 16/5/23.
//  Copyright © 2016年 鲜世杰. All rights reserved.
//

import UIKit
extension NSAttributedString {

    class func attributedWithEmotion(emoticon: XSJEmoticon, font: UIFont) -> NSAttributedString{
        let image = UIImage(named: emoticon.path!)
        let attachtment = XSJTextAttachment()
        attachtment.emoticon = emoticon
        attachtment.image = image
        let fontHeight = font.lineHeight
        attachtment.bounds = CGRect(x: 0, y: -4, width: fontHeight, height: fontHeight)
        
        let attr = NSAttributedString(attachment: attachtment)
        return attr


    }
    
    
    
}
